﻿using System;
using EPiServer.Core;
using EPiServer.Filters;

namespace EPiBoost.Core.Filters.PageFilters
{
    public class FilterVisibleInMenu : IPageFilter
    {
        public void Filter(PageDataCollection pages)
        {
            for (int i = pages.Count - 1; i >= 0; i--)
            {
                if (!pages[i].VisibleInMenu)
                {
                    pages.RemoveAt(i);
                }
            }
        }

        public void Filter(object sender, FilterEventArgs e)
        {
            this.Filter(e.Pages);
        }

        public bool ShouldFilter(PageData page)
        {
            throw new NotImplementedException();
        }
    }
}
